package com.tykboot.message;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

/**
 * 响应消息
 *
 * @author LiuYu
 **/

@ApiModel("response")
public class ResponseMsg<T> implements Serializable {
    @ApiModelProperty(name = "code", value = "code", notes = "状态")
    private int code = MsgCode.Success.value();

    @ApiModelProperty(name = "desc", value = "desc", notes = "描述")

    private String desc = MsgCode.Success.desc();
    @ApiModelProperty(name = "data", value = "data", notes = "内容")
    private T data;

    public ResponseMsg() {
    }

    public ResponseMsg(MsgCode msgCode) {
        this.code = msgCode.value();
        this.desc = msgCode.desc();
    }

    public ResponseMsg(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public ResponseMsg(int code, T data, String desc) {
        this.code = code;
        this.desc = desc;
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
